﻿/*!	@file	r_gui_menuinfo.h
	@brief	GUIメニューデータクラス
Copyright (c) 2010 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _R_GUI_MENUINFO_H_
#define _R_GUI_MENUINFO_H_

#include "r_gui_def.h"
#include "r_gui_allocator.h"
#include "r_gui_string.h"
#include "../rtti/r_rtti_class_base.h"
#include "../util/r_util_stdstring.h"
#include "../util/r_util_signals.h"
#include "../util/r_util_sharedptr.h"
#include <vector>

namespace r{
	namespace gui{
		enum	MenuType {
			MenuType_Menu	= 0,		//!< 通常のメニュー
			MenuType_Separator,		//!< メニューはセパレータ
		};

		class MenuInfo : public r::rtti::ClassBase
		{
			RRTTI_REFLECTION_DECLARE
			typedef	std::vector< MenuInfo, r::gui::Allocator< MenuInfo > >	MenuInfo_array;
		public:
			//! コンストラクタ
			/*!
			*/
			MenuInfo();
			//! デストラクタ
			/*!
			*/
			~MenuInfo();
		public:
			//! サブメニュー数の取得
			/*!
			*/
			r_si32						getSubMenuNum() const;
			//! 名前の設定
			/*!
			*/
			void						setName ( const r_cstr _name );
			//! 名前の取得
			/*!
			*/
			const	r_cstr				getName() const;
			//! 名前の長さ
			/*!
			*/
			r_si32						getNameLength() const;
			//! IDの割り当て
			/*!
			*/
			void						setID ( r_si32 _id );
			//! IDの取得
			/*!
			*/
			r_si32						getID() const;
			//! typeの設定
			/*!
			*/
			void						setType ( r_si32 _type );
			//! typeの取得
			/*!
			*/
			r_si32						getType() const;


			//! サブメニューの参照
			/*!
			*/
			const MenuInfo*		getSubMenu ( r_si32 index ) const;
			MenuInfo*				getSubMenu ( r_si32 index );

			//! サブメニューの追加
			/*!
			*/
			void						addSubMenu ( const MenuInfo& menu );
		protected:
		private:
			r::gui::string				name;
			r_si32						id;
			r_si32						type;
			MenuInfo_array			subMenu;
		};
	}
}


#endif // _R_GUI_MENUINFO_H_


